package ullio.video
{
	import flash.events.MouseEvent;
	
	import mx.controls.Button;
	
	import ullio.events.AppEvent;
	
 	[Event( name="playPauseClick", type="AppEvent" )]

	public class PlayPauseButton extends Button
	{
		
		private var _playPressed:Boolean;
		public function set playPressed(value:Boolean):void{
			_playPressed = value;
		}
		public function get playPressed():Boolean{
			return _playPressed;
		}
		
		public function PlayPauseButton()
		{
			super();
			toggle = true;
			addEventListener(MouseEvent.CLICK, goPlayPauseClick);
			useHandCursor = true;
			buttonMode = true;
			mouseChildren = false;			
		}
		
		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
    	{
			super.updateDisplayList(unscaledWidth, unscaledHeight);
			toolTip = enabled ? '' : 'No video is loaded';
    	}
		
		private function goPlayPauseClick(event:MouseEvent):void{
			_playPressed = true; // so we know the status change came from a mouse click			
			dispatchEvent(new AppEvent("playPauseClick",{selected:selected}));
		}
		
		
	}
}